/*
 * @Author: Dee Dee
 * @Date: 2022-04-22 09:15:05
 * @LastEditors: Dee Dee
 * @LastEditTime: 2023-10-13 11:46:07
 * @FilePath: /培训认证系统20230426/src/api/vadmin/train/train.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/utils/request'

/**
 * 列表
 */
export const getTrain = (query) => {
    return request({
        url: '/TrainTask/',
        method: 'get',
        params: query
    })
}
/**
 * 当前用户列表
 */
export const getTrainOwn = (query) => {
    return request({
        url: '/TrainTask/',
        method: 'get',
        params: query
    })
}


/**
 * x新增
 */
export const addTrain = (data) => {
    return request({
        url: '/TrainTask/',
        method: 'post',
        data: data
    })
}
/**
 * x修改
 */
export const updateTrain = (data) => {
    return request({
        url: '/TrainTask/' + data.id + '/',
        method: 'patch',
        data: data
    })
}
/**
 * 删除
 */
export const delTrain = (id) => {
    return request({
        url: '/TrainTask/' + id + '/',
        method: 'delete',
    })
}
/**
 * 知识点学习情况
 */
export const TrainKnowledgeRecord = (query) => {
    return request({
        url: '/TrainKnowledgeRecord/',
        method: 'get',
        params: query
    })
}


/**
 * 详情
 * @param data
 */
export function trainDetail(id) {
    return request({
        url: '/train/' + id + '/',
        method: 'get'
    })
}
export function trainTestDetail(id) {
    return request({
        url: '/TrainTask/' + id + '/',
        method: 'get'
    })
}
export function statisticsTrain(id) {
    return request({
        url: `/train/?train_task=${id}`,
        method: 'get'
    })
}
/**
 * 随堂测验
 * @param data
 */
export function getTrainTest(query) {
    return request({
        url: '/TrainTest/',
        method: 'get',
        params: query
    })
}
/**
 * 提交随堂测验
 * @param data
 */
export function postTrainTest(data) {
    return request({
        url: '/TrainTest/',
        method: 'post',
        data: data
    })
}
export function getTrainList(query) {
    return request({
        url: '/train/',
        method: 'get',
        params: query
    })
}
